---客户端开发辅助接口
--@module
local _svr = class('App', require('framework.cls.baseserver'))
--===================================
--default params
local d = Ding
local Logger = d.Logger
--===================================

function _svr:ctor()
    _svr.super:ctor()
    Logger:dump(cfg, '-->>App cfg is')
    Logger:info('\n%s server is runing...', self:name())

    self:init_router()
end

function _svr:init_router()
    local orm_usr = d.Orm:get("usr")
    local orm_actusr = d.Orm:get("actusr")

    local uc = require('api.handler.uc').new(self, orm_usr, orm_actusr)
    self:post(
        '/login/phone',
        function()
            uc:post_phonelogin()
        end,
        '/login/userpwd',
        function()
            uc:post_userpwdlogin()
        end,
        '/register/userpwd', 
        function()
            uc:post_add_pwdusr()
        end
    )
    self:get(
        '/token',
        function()
            uc:get_refreshtoken()
        end,
        '/user',
        function()
            uc:get_userinfo()
        end,
        '/islogin',
        function()
            uc:get_islogin()
        end
    )
end

return _svr
